<template>
  <canvas ref="canvas" class="absolute" />
</template>

<script setup lang="ts">
import { CurveCanvas } from '@/common/draw/CurveCanvas'
import { ref, watch } from 'vue'

const canvas = ref<HTMLCanvasElement>()
const { width, height, startY, margin, lstCurveConfig } = defineProps<{
  width: number
  height: number
  startY: number
  margin: number
  lstCurveConfig: CurveConfig[]
}>()

watch([width, height, startY, margin], async () => {
  // 绘制曲线
  const cxt = canvas.value!.getContext('2d')!
  new CurveCanvas(canvas.value!, cxt, width, height, startY, margin, lstCurveConfig)
})
</script>

<style scoped></style>
